package org.osll.tictactoe.engine;

import org.osll.tictactoe.game.Game;
import org.osll.tictactoe.game.Transport;
import org.osll.tictactoe.transport.tcp.server.GameServer;

public class TransportImpl implements Transport {

	private GameServer tcpServer;
	private org.osll.tictactoe.transport.udp.server.GameServer udpServer;
	
	private org.osll.tictactoe.transport.corba.server.GameServer corbaServer;
	
	private org.osll.tictactoe.transport.rmi.server.GameServer rmiServer;
	
	public TransportImpl(Game controller) {
		tcpServer = new GameServer(controller);
		new Thread(tcpServer).start();
		udpServer = new org.osll.tictactoe.transport.udp.server.GameServer(controller);
		new Thread(udpServer).start();
		corbaServer = new org.osll.tictactoe.transport.corba.server.GameServer(controller);
		new Thread(corbaServer).start();
		rmiServer = new org.osll.tictactoe.transport.rmi.server.GameServer(controller);
		new Thread(rmiServer).start();
		
	}
	
	@Override
	public String getCorbaService() {
		// TODO Auto-generated method stub
		return corbaServer.getServiceName();
	}

	@Override
	public String getRmiService() {
		// TODO Auto-generated method stub
		return rmiServer.getServiceName();
	}

	@Override
	public int getTcpPort() {
		return tcpServer.getPort();
	}

	@Override
	public int getUdpPort() {
		// TODO Auto-generated method stub
		return udpServer.getPort();
	}

}
